package cn.apelx.order.service;

import io.seata.rm.tcc.api.BusinessActionContext;
import io.seata.rm.tcc.api.BusinessActionContextParameter;
import io.seata.rm.tcc.api.LocalTCC;
import io.seata.rm.tcc.api.TwoPhaseBusinessAction;

import java.math.BigDecimal;

/**
 * 订单服务
 *
 * @author apelx
 * @since 2022-05-02
 */
@LocalTCC
public interface OrderService {

    @TwoPhaseBusinessAction(name = "createTcc", commitMethod = "createTccCommit", rollbackMethod = "createTccRollback")
    void createTcc(BusinessActionContext actionContext,
                   @BusinessActionContextParameter(paramName = "orderName") String orderName,
                   @BusinessActionContextParameter(paramName = "orderPrice") BigDecimal orderPrice);

    void createTccCommit(BusinessActionContext actionContext);

    void createTccRollback(BusinessActionContext actionContext);
}
